package networkInterface;

import java.awt.Color;

import exception.NoConnectionPossibleException;

import object.Node;

public abstract class PhoneInterfaceBase extends NetworkInterfaceBase {
	protected double range = 0;

	public PhoneInterfaceBase(Node node, Color c) {
		super(c, node);
	}
	
	public Double getRange() {
		return range;
	}
	
	@Override
	public void addConnection(NetworkInterfaceBase netInt) throws NoConnectionPossibleException, IllegalStateException {
		String ret = canConnectWithReason(netInt);
		if(ret != null)
			throw new NoConnectionPossibleException(ret);

		PhoneInterfaceBase n = (PhoneInterfaceBase)netInt;

		object.Connection c = new object.Connection();
		c.setInterfaces(this, n);
		connections.add(c);
		n.addConnectionWithoutCheck(c);
	}

}
